    clear;clc;close all
    addpath('./util');
%% 载入数据
    LF = loadtiff('.\data\20200623_1_LF_126_1560.tif');

%% 可视化原始体数据
    Visualization3D_LF(LF,[0.325 0.325 1]);

    %% beads中心点提取
    centroids_subpixel = detect_beads_LF_2(LF);

    X_LF = centroids_subpixel(:, 1);
    Y_LF = centroids_subpixel(:, 2);
    Z_LF = centroids_subpixel(:, 3);

%   [xx_lf, yy_lf, zz_lf] = refine_beads_center_in_sub_voxel(LF, X_LF, Y_LF, Z_LF, [31,31,15]);

    xx_lf = X_LF';
    yy_lf = Y_LF';
    zz_lf = Z_LF';

%% 投影视图
    figure, imshow(imadjust(max(volData, [], 3))),title('LS beads xy');
    for i = 1:size(centroids_subpixel,1)
        hold on, plot(centroids_subpixel(i,1), centroids_subpixel(i,2), 'o', 'MarkerSize', 5);
    end

    figure, imshow(imadjust(squeeze(max(volData, [], 2)))), title('LS beads yz');
    for i = 1:size(centroids_subpixel,1)
        hold on, plot(centroids_subpixel(i,3), centroids_subpixel(i,2), 'o', 'MarkerSize', 3);
    end

%% 3D显示体数据及中心坐标叠加
    Visualization3D_LF(LF,[0.325 0.325 1],[],1,centroids_subpixel,3);